
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter_app/openeye/widget/app_bar.dart';
import 'package:flutter_app/stateLearn/click_txt.dart';

class JsonTest extends StatefulWidget {
  const JsonTest({Key? key}) : super(key: key);
  @override
  _JsonTestState createState() => _JsonTestState();
}

class _JsonTestState extends State<JsonTest> {
  final jsonInfo = '{"name": "John Smith","email": "john@example.com"}';

  @override
  Widget build(BuildContext context) {
    return materialPage(
        page: createJsonPage(),
        appBar: appBar("序列化")
    );
  }

  createJsonPage() {
    return Container(
      alignment: Alignment.center,
      child:  ClickTxt(info: "序列化mod",onPressed: (){
              // var user = User.forJson(json.decode(jsonInfo));
              // print('实例化的对象是:${json.encode(user)}');
              },),
    );
  }
}
